package com.example.other.controller;

import com.example.authority.common.entity.Result;
import com.example.other.domain.dto.ReportDto;
import org.springframework.web.bind.annotation.*;

@RestController
public class ReportController extends BaseController {


    @GetMapping("/report")
    public Result getReportByOrderId(@RequestParam Integer orderid) {
        try {
            return Result.succ(checkitemdetailedService.getReportByOrderId(orderid));
        } catch (Exception e) {
            return Result.fail(e.getMessage());
        }
    }

    @PostMapping("/report/save")
    public Result updateReportByOrderId(@RequestBody ReportDto reportDto) {

        try {
            return Result.succ(checkitemdetailedService.updateReport(reportDto));
        } catch (Exception e) {
            return Result.fail(e.getMessage());
        }
    }

    @PostMapping("/report/achieve")
    public Result achieveReport(@RequestBody ReportDto reportDto) {
        try {
            return Result.succ(checkitemdetailedService.archiveReport(reportDto));
        } catch (Exception e) {
            return Result.fail(e.getMessage());
        }
    }
}
